<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>健身房后台管理系统</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath }/static/css/style.css"/>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath }/static/css/public.css"/>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>健身房后台管理系统</h1>
    <div class="publicHeaderR">
        <p><span id="greeting">下午好！</span><span style="color: #fff21b">, ${userSession.username }</span> , 欢迎你！</p>
        <a href="${pageContext.request.contextPath }/logout.do">退出</a>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
</section>
<!--主体内容-->
<section class="publicMian">
    <div class="left">
        <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
        <nav>
            <ul class="list" id="list">
                <c:forEach items="${menus}" var="menu">
                    <li class="menu-item">
                        <a href="${menu.url}" class="toggle-icon">${menu.name}</a>
                        <c:if test="${not empty menu.children}">
                            <!-- 嵌套迭代子菜单 -->
                            <ul class="sub-menu">
                                <c:forEach items="${menu.children}" var="child">
                                    <li>
                                        <a style="color:pink;" href="${pageContext.request.contextPath}/gymjsp${child.url}.do?method=query">${child.name}</a>
                                        <!-- 如果还有子菜单，继续嵌套迭代 -->
                                        <c:if test="${not empty child.children}">
                                            <ul>
                                                <c:forEach items="${child.children}" var="subchild">
                                                    <li><a href="${subchild.url}">${subchild.name}</a></li>
                                                    <!-- 可根据需要继续嵌套迭代更多层级的子菜单 -->
                                                </c:forEach>
                                            </ul>
                                        </c:if>
                                    </li>
                                </c:forEach>
                            </ul>
                        </c:if>
                    </li>
                </c:forEach>
            </ul>
        </nav>
    </div>
    <input type="hidden" id="path" name="path" value="${pageContext.request.contextPath }"/>
    <input type="hidden" id="referer" name="referer" value="<%=request.getHeader("Referer")%>"/>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.8.3.min.js"></script>
    <script type="application/javascript">
        $(".sub-menu").hide();
        $(document).ready(function() {
            // 为一级菜单添加点击事件处理程序
            $('.menu-item').click(function(e) {
                // e.preventDefault(); // 阻止默认点击事件
                var subMenu = $(this).find('.sub-menu'); // 获取对应的二级菜单
                if (subMenu.length > 0) {
                    // 切换二级菜单的显示状
                    subMenu.slideToggle();
                }
            });
        });
    </script>
    <style>

    </style>